/**
 */
package org.cmoine.perspectiveshare.model.impl;

import org.cmoine.perspectiveshare.model.FolderType;
import org.cmoine.perspectiveshare.model.InfoType;
import org.cmoine.perspectiveshare.model.PerspectivesPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Info Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getMixed <em>Mixed</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getFolder <em>Folder</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getFolder1 <em>Folder1</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getPart <em>Part</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getRatio <em>Ratio</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getRatioLeft <em>Ratio Left</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getRatioRight <em>Ratio Right</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getRelationship <em>Relationship</em>}</li>
 *   <li>{@link org.cmoine.perspectiveshare.model.impl.InfoTypeImpl#getRelative <em>Relative</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class InfoTypeImpl extends EObjectImpl implements InfoType {
    /**
     * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getMixed()
     * @generated
     * @ordered
     */
    protected FeatureMap mixed;

    /**
     * The default value of the '{@link #getFolder1() <em>Folder1</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getFolder1()
     * @generated
     * @ordered
     */
    protected static final String FOLDER1_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getFolder1() <em>Folder1</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getFolder1()
     * @generated
     * @ordered
     */
    protected String folder1 = FOLDER1_EDEFAULT;

    /**
     * The default value of the '{@link #getPart() <em>Part</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getPart()
     * @generated
     * @ordered
     */
    protected static final String PART_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getPart() <em>Part</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getPart()
     * @generated
     * @ordered
     */
    protected String part = PART_EDEFAULT;

    /**
     * The default value of the '{@link #getRatio() <em>Ratio</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRatio()
     * @generated
     * @ordered
     */
    protected static final float RATIO_EDEFAULT = 0.0F;

    /**
     * The cached value of the '{@link #getRatio() <em>Ratio</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRatio()
     * @generated
     * @ordered
     */
    protected float ratio = RATIO_EDEFAULT;

    /**
     * This is true if the Ratio attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean ratioESet;

    /**
     * The default value of the '{@link #getRatioLeft() <em>Ratio Left</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRatioLeft()
     * @generated
     * @ordered
     */
    protected static final short RATIO_LEFT_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getRatioLeft() <em>Ratio Left</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRatioLeft()
     * @generated
     * @ordered
     */
    protected short ratioLeft = RATIO_LEFT_EDEFAULT;

    /**
     * This is true if the Ratio Left attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean ratioLeftESet;

    /**
     * The default value of the '{@link #getRatioRight() <em>Ratio Right</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRatioRight()
     * @generated
     * @ordered
     */
    protected static final short RATIO_RIGHT_EDEFAULT = 0;

    /**
     * The cached value of the '{@link #getRatioRight() <em>Ratio Right</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRatioRight()
     * @generated
     * @ordered
     */
    protected short ratioRight = RATIO_RIGHT_EDEFAULT;

    /**
     * This is true if the Ratio Right attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean ratioRightESet;

    /**
     * The default value of the '{@link #getRelationship() <em>Relationship</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRelationship()
     * @generated
     * @ordered
     */
    protected static final byte RELATIONSHIP_EDEFAULT = 0x00;

    /**
     * The cached value of the '{@link #getRelationship() <em>Relationship</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRelationship()
     * @generated
     * @ordered
     */
    protected byte relationship = RELATIONSHIP_EDEFAULT;

    /**
     * This is true if the Relationship attribute has been set.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     * @ordered
     */
    protected boolean relationshipESet;

    /**
     * The default value of the '{@link #getRelative() <em>Relative</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRelative()
     * @generated
     * @ordered
     */
    protected static final String RELATIVE_EDEFAULT = null;

    /**
     * The cached value of the '{@link #getRelative() <em>Relative</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #getRelative()
     * @generated
     * @ordered
     */
    protected String relative = RELATIVE_EDEFAULT;

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    protected InfoTypeImpl() {
        super();
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    protected EClass eStaticClass() {
        return PerspectivesPackage.Literals.INFO_TYPE;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public FeatureMap getMixed() {
        if (mixed == null) {
            mixed = new BasicFeatureMap(this, PerspectivesPackage.INFO_TYPE__MIXED);
        }
        return mixed;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public FolderType getFolder() {
        return (FolderType)getMixed().get(PerspectivesPackage.Literals.INFO_TYPE__FOLDER, true);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public NotificationChain basicSetFolder(FolderType newFolder, NotificationChain msgs) {
        return ((FeatureMap.Internal)getMixed()).basicAdd(PerspectivesPackage.Literals.INFO_TYPE__FOLDER, newFolder, msgs);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setFolder(FolderType newFolder) {
        ((FeatureMap.Internal)getMixed()).set(PerspectivesPackage.Literals.INFO_TYPE__FOLDER, newFolder);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getFolder1() {
        return folder1;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setFolder1(String newFolder1) {
        String oldFolder1 = folder1;
        folder1 = newFolder1;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, PerspectivesPackage.INFO_TYPE__FOLDER1, oldFolder1, folder1));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getPart() {
        return part;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setPart(String newPart) {
        String oldPart = part;
        part = newPart;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, PerspectivesPackage.INFO_TYPE__PART, oldPart, part));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public float getRatio() {
        return ratio;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setRatio(float newRatio) {
        float oldRatio = ratio;
        ratio = newRatio;
        boolean oldRatioESet = ratioESet;
        ratioESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, PerspectivesPackage.INFO_TYPE__RATIO, oldRatio, ratio, !oldRatioESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetRatio() {
        float oldRatio = ratio;
        boolean oldRatioESet = ratioESet;
        ratio = RATIO_EDEFAULT;
        ratioESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, PerspectivesPackage.INFO_TYPE__RATIO, oldRatio, RATIO_EDEFAULT, oldRatioESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetRatio() {
        return ratioESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public short getRatioLeft() {
        return ratioLeft;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setRatioLeft(short newRatioLeft) {
        short oldRatioLeft = ratioLeft;
        ratioLeft = newRatioLeft;
        boolean oldRatioLeftESet = ratioLeftESet;
        ratioLeftESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, PerspectivesPackage.INFO_TYPE__RATIO_LEFT, oldRatioLeft, ratioLeft, !oldRatioLeftESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetRatioLeft() {
        short oldRatioLeft = ratioLeft;
        boolean oldRatioLeftESet = ratioLeftESet;
        ratioLeft = RATIO_LEFT_EDEFAULT;
        ratioLeftESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, PerspectivesPackage.INFO_TYPE__RATIO_LEFT, oldRatioLeft, RATIO_LEFT_EDEFAULT, oldRatioLeftESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetRatioLeft() {
        return ratioLeftESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public short getRatioRight() {
        return ratioRight;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setRatioRight(short newRatioRight) {
        short oldRatioRight = ratioRight;
        ratioRight = newRatioRight;
        boolean oldRatioRightESet = ratioRightESet;
        ratioRightESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, PerspectivesPackage.INFO_TYPE__RATIO_RIGHT, oldRatioRight, ratioRight, !oldRatioRightESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetRatioRight() {
        short oldRatioRight = ratioRight;
        boolean oldRatioRightESet = ratioRightESet;
        ratioRight = RATIO_RIGHT_EDEFAULT;
        ratioRightESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, PerspectivesPackage.INFO_TYPE__RATIO_RIGHT, oldRatioRight, RATIO_RIGHT_EDEFAULT, oldRatioRightESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetRatioRight() {
        return ratioRightESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public byte getRelationship() {
        return relationship;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setRelationship(byte newRelationship) {
        byte oldRelationship = relationship;
        relationship = newRelationship;
        boolean oldRelationshipESet = relationshipESet;
        relationshipESet = true;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, PerspectivesPackage.INFO_TYPE__RELATIONSHIP, oldRelationship, relationship, !oldRelationshipESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void unsetRelationship() {
        byte oldRelationship = relationship;
        boolean oldRelationshipESet = relationshipESet;
        relationship = RELATIONSHIP_EDEFAULT;
        relationshipESet = false;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.UNSET, PerspectivesPackage.INFO_TYPE__RELATIONSHIP, oldRelationship, RELATIONSHIP_EDEFAULT, oldRelationshipESet));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isSetRelationship() {
        return relationshipESet;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public String getRelative() {
        return relative;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setRelative(String newRelative) {
        String oldRelative = relative;
        relative = newRelative;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, PerspectivesPackage.INFO_TYPE__RELATIVE, oldRelative, relative));
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
        switch (featureID) {
            case PerspectivesPackage.INFO_TYPE__MIXED:
                return ((InternalEList<?>)getMixed()).basicRemove(otherEnd, msgs);
            case PerspectivesPackage.INFO_TYPE__FOLDER:
                return basicSetFolder(null, msgs);
        }
        return super.eInverseRemove(otherEnd, featureID, msgs);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case PerspectivesPackage.INFO_TYPE__MIXED:
                if (coreType) return getMixed();
                return ((FeatureMap.Internal)getMixed()).getWrapper();
            case PerspectivesPackage.INFO_TYPE__FOLDER:
                return getFolder();
            case PerspectivesPackage.INFO_TYPE__FOLDER1:
                return getFolder1();
            case PerspectivesPackage.INFO_TYPE__PART:
                return getPart();
            case PerspectivesPackage.INFO_TYPE__RATIO:
                return getRatio();
            case PerspectivesPackage.INFO_TYPE__RATIO_LEFT:
                return getRatioLeft();
            case PerspectivesPackage.INFO_TYPE__RATIO_RIGHT:
                return getRatioRight();
            case PerspectivesPackage.INFO_TYPE__RELATIONSHIP:
                return getRelationship();
            case PerspectivesPackage.INFO_TYPE__RELATIVE:
                return getRelative();
        }
        return super.eGet(featureID, resolve, coreType);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case PerspectivesPackage.INFO_TYPE__MIXED:
                ((FeatureMap.Internal)getMixed()).set(newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__FOLDER:
                setFolder((FolderType)newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__FOLDER1:
                setFolder1((String)newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__PART:
                setPart((String)newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__RATIO:
                setRatio((Float)newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__RATIO_LEFT:
                setRatioLeft((Short)newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__RATIO_RIGHT:
                setRatioRight((Short)newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__RELATIONSHIP:
                setRelationship((Byte)newValue);
                return;
            case PerspectivesPackage.INFO_TYPE__RELATIVE:
                setRelative((String)newValue);
                return;
        }
        super.eSet(featureID, newValue);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public void eUnset(int featureID) {
        switch (featureID) {
            case PerspectivesPackage.INFO_TYPE__MIXED:
                getMixed().clear();
                return;
            case PerspectivesPackage.INFO_TYPE__FOLDER:
                setFolder((FolderType)null);
                return;
            case PerspectivesPackage.INFO_TYPE__FOLDER1:
                setFolder1(FOLDER1_EDEFAULT);
                return;
            case PerspectivesPackage.INFO_TYPE__PART:
                setPart(PART_EDEFAULT);
                return;
            case PerspectivesPackage.INFO_TYPE__RATIO:
                unsetRatio();
                return;
            case PerspectivesPackage.INFO_TYPE__RATIO_LEFT:
                unsetRatioLeft();
                return;
            case PerspectivesPackage.INFO_TYPE__RATIO_RIGHT:
                unsetRatioRight();
                return;
            case PerspectivesPackage.INFO_TYPE__RELATIONSHIP:
                unsetRelationship();
                return;
            case PerspectivesPackage.INFO_TYPE__RELATIVE:
                setRelative(RELATIVE_EDEFAULT);
                return;
        }
        super.eUnset(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public boolean eIsSet(int featureID) {
        switch (featureID) {
            case PerspectivesPackage.INFO_TYPE__MIXED:
                return mixed != null && !mixed.isEmpty();
            case PerspectivesPackage.INFO_TYPE__FOLDER:
                return getFolder() != null;
            case PerspectivesPackage.INFO_TYPE__FOLDER1:
                return FOLDER1_EDEFAULT == null ? folder1 != null : !FOLDER1_EDEFAULT.equals(folder1);
            case PerspectivesPackage.INFO_TYPE__PART:
                return PART_EDEFAULT == null ? part != null : !PART_EDEFAULT.equals(part);
            case PerspectivesPackage.INFO_TYPE__RATIO:
                return isSetRatio();
            case PerspectivesPackage.INFO_TYPE__RATIO_LEFT:
                return isSetRatioLeft();
            case PerspectivesPackage.INFO_TYPE__RATIO_RIGHT:
                return isSetRatioRight();
            case PerspectivesPackage.INFO_TYPE__RELATIONSHIP:
                return isSetRelationship();
            case PerspectivesPackage.INFO_TYPE__RELATIVE:
                return RELATIVE_EDEFAULT == null ? relative != null : !RELATIVE_EDEFAULT.equals(relative);
        }
        return super.eIsSet(featureID);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    public String toString() {
        if (eIsProxy()) return super.toString();

        StringBuffer result = new StringBuffer(super.toString());
        result.append(" (mixed: "); //$NON-NLS-1$
        result.append(mixed);
        result.append(", folder1: "); //$NON-NLS-1$
        result.append(folder1);
        result.append(", part: "); //$NON-NLS-1$
        result.append(part);
        result.append(", ratio: "); //$NON-NLS-1$
        if (ratioESet) result.append(ratio); else result.append("<unset>"); //$NON-NLS-1$
        result.append(", ratioLeft: "); //$NON-NLS-1$
        if (ratioLeftESet) result.append(ratioLeft); else result.append("<unset>"); //$NON-NLS-1$
        result.append(", ratioRight: "); //$NON-NLS-1$
        if (ratioRightESet) result.append(ratioRight); else result.append("<unset>"); //$NON-NLS-1$
        result.append(", relationship: "); //$NON-NLS-1$
        if (relationshipESet) result.append(relationship); else result.append("<unset>"); //$NON-NLS-1$
        result.append(", relative: "); //$NON-NLS-1$
        result.append(relative);
        result.append(')');
        return result.toString();
    }

} //InfoTypeImpl
